<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>SpringCloud With Docker | Cying</title><meta name="keywords" content="JavaEE"><meta name="author" content="Cying-承影"><meta name="copyright" content="Cying-承影"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="1、安装 Linux 系统 略，可使用 VMware 或阿里云等其他服务器，装完后顺便换个源，装个 JDK  2、安装 docker 略，不同系统有不同操作步骤  3、远程连接 通过 ssh 进行远程连接，使用 scp 进行文件上传与下载，无需下载其他软件，以下是在 Windows Terminal 中进行操作 bash1ssh 用户名@域名或IP地址 	#回车后输入该用户密码即可   bash1">
<meta property="og:type" content="article">
<meta property="og:title" content="SpringCloud With Docker">
<meta property="og:url" content="http://cyingk.github.io/2020/08/06/Linux-And-Docker/index.html">
<meta property="og:site_name" content="Cying">
<meta property="og:description" content="1、安装 Linux 系统 略，可使用 VMware 或阿里云等其他服务器，装完后顺便换个源，装个 JDK  2、安装 docker 略，不同系统有不同操作步骤  3、远程连接 通过 ssh 进行远程连接，使用 scp 进行文件上传与下载，无需下载其他软件，以下是在 Windows Terminal 中进行操作 bash1ssh 用户名@域名或IP地址 	#回车后输入该用户密码即可   bash1">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://img-blog.csdnimg.cn/202008061653587.png">
<meta property="article:published_time" content="2020-08-06T08:51:00.000Z">
<meta property="article:modified_time" content="2020-08-06T09:09:50.336Z">
<meta property="article:author" content="Cying-承影">
<meta property="article:tag" content="JavaEE">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://img-blog.csdnimg.cn/202008061653587.png"><link rel="shortcut icon" href="/img/favicon.ico"><link rel="canonical" href="http://cyingk.github.io/2020/08/06/Linux-And-Docker/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//www.clarity.ms"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><script>(function(c,l,a,r,i,t,y){
    c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
    t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
    y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "4zndahq92q");</script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: 'days',
  date_suffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"Traditional Chinese Activated Manually","cht_to_chs":"Simplified Chinese Activated Manually","day_to_night":"Dark Mode Activated Manually","night_to_day":"Light Mode Activated Manually","bgLight":"#49b1f5","bgDark":"#121212","position":"bottom-left"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: false,
  isanchor: false
};

const saveToLocal = {
  // ttl 單位是 天
  set: function setWithExpiry(key, value, ttl) {
    if (ttl === 0) return
    const now = new Date()
    const expiryDay = ttl * 86400000
    const item = {
      value: value,
      expiry: now.getTime() + expiryDay,
    }
    localStorage.setItem(key, JSON.stringify(item))
  },

  get: function getWithExpiry(key) {
    const itemStr = localStorage.getItem(key)

    if (!itemStr) {
      return undefined
    }
    const item = JSON.parse(itemStr)
    const now = new Date()

    if (now.getTime() > item.expiry) {
      localStorage.removeItem(key)
      return undefined
    }
    return item.value
  }
}

// https://stackoverflow.com/questions/16839698/jquery-getscript-alternative-in-native-javascript
const getScript = url => new Promise((resolve, reject) => {
  const script = document.createElement('script')
  script.src = url
  script.async = true
  script.onerror = reject
  script.onload = script.onreadystatechange = function() {
    const loadState = this.readyState
    if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
    script.onload = script.onreadystatechange = null
    resolve()
  }
  document.head.appendChild(script)
})</script><script id="config_change">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2020-08-06 17:09:50'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(function () {  window.activateDarkMode = function () {
    document.documentElement.setAttribute('data-theme', 'dark')
    if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
    }
  }
  window.activateLightMode = function () {
    document.documentElement.setAttribute('data-theme', 'light')
   if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
    }
  }
  const autoChangeMode = '1'
  const t = saveToLocal.get('theme')
  if (autoChangeMode === '1') {
    const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
    const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
    const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
    const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
    if (t === undefined) {
      if (isLightMode) activateLightMode()
      else if (isDarkMode) activateDarkMode()
      else if (isNotSpecified || hasNoSupport) {
        const now = new Date()
        const hour = now.getHours()
        const isNight = hour <= 6 || hour >= 18
        isNight ? activateDarkMode() : activateLightMode()
      }
      window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
        if (saveToLocal.get('theme') === undefined) {
          e.matches ? activateDarkMode() : activateLightMode()
        }
      })
    } else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else if (autoChangeMode === '2') {
    const now = new Date()
    const hour = now.getHours()
    const isNight = hour <= 6 || hour >= 18
    if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
    else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else {
    if (t === 'dark') activateDarkMode()
    else if (t === 'light') activateLightMode()
  }const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
   if (asideStatus === 'hide') {
     document.documentElement.classList.add('hide-aside')
   } else {
     document.documentElement.classList.remove('hide-aside')
   }
}const fontSizeVal = saveToLocal.get('global-font-size')
if (fontSizeVal !== undefined) {
  document.documentElement.style.setProperty('--global-font-size', fontSizeVal + 'px')
}})()</script><meta name="generator" content="Hexo 5.3.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">Loading...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="/img/avatar.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">23</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">12</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">Categories</div><div class="length-num">3</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fa fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fa fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> Categories</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://5b0988e595225.cdn.sohucs.com/images/20190831/84729f5c5bb346208416445feb485df6.jpeg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Cying</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fa fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fa fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> Categories</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">SpringCloud With Docker</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">Created</span><time class="post-meta-date-created" datetime="2020-08-06T08:51:00.000Z" title="Created 2020-08-06 16:51:00">2020-08-06</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2020-08-06T09:09:50.336Z" title="Updated 2020-08-06 17:09:50">2020-08-06</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Blog/">Blog</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">Word count:</span><span class="word-count">892</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">Reading time:</span><span>3min</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">Post View:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><html><head></head><body><h1 id="1、安装-Linux-系统"><a href="#1、安装-Linux-系统" class="headerlink" title="1、安装 Linux 系统"></a>1、安装 Linux 系统</h1><blockquote>
<p>略，可使用 <code>VMware</code> 或阿里云等其他服务器，装完后顺便换个源，装个 <code>JDK</code></p>
</blockquote>
<h1 id="2、安装-docker"><a href="#2、安装-docker" class="headerlink" title="2、安装 docker"></a>2、安装 docker</h1><blockquote>
<p>略，不同系统有不同操作步骤</p>
</blockquote>
<h1 id="3、远程连接"><a href="#3、远程连接" class="headerlink" title="3、远程连接"></a>3、远程连接</h1><blockquote>
<p>通过 <code>ssh</code> 进行远程连接，使用 <code>scp</code> 进行文件上传与下载，无需下载其他软件，以下是在 <code>Windows Terminal</code> 中进行操作</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">bash</div></div><figure class="highlight bash"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh 用户名@域名或IP地址 	<span class="comment">#回车后输入该用户密码即可</span></span><br></pre></td></tr></tbody></table></figure></div>

<p><a target="_blank" rel="noopener" href="https://img-blog.csdnimg.cn/2020080615115060.png" data-fancybox="group" data-caption="在这里插入图片描述" class="fancybox"><img alt="在这里插入图片描述" title="在这里插入图片描述" data-src="https://img-blog.csdnimg.cn/2020080615115060.png" class="lazyload"></a></p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">bash</div></div><figure class="highlight bash"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">scp 本地文件路径 用户名@域名或IP地址:服务器文件路径 		<span class="comment">#上传文件, 若要上传文件夹则加上 -r</span></span><br><span class="line">scp 用户名@域名或IP地址:服务器文件路径 本地文件路径 		<span class="comment">#下载文件, 若要下载文件夹则加上 -r</span></span><br></pre></td></tr></tbody></table></figure></div>

<p><a target="_blank" rel="noopener" href="https://img-blog.csdnimg.cn/20200806151655727.png" data-fancybox="group" data-caption="在这里插入图片描述" class="fancybox"><img alt="在这里插入图片描述" title="在这里插入图片描述" data-src="https://img-blog.csdnimg.cn/20200806151655727.png" class="lazyload"></a></p>
</blockquote>
<h1 id="4、拉镜像"><a href="#4、拉镜像" class="headerlink" title="4、拉镜像"></a>4、拉镜像</h1><blockquote>
<ul>
<li><p>Nacos</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">shell</div></div><figure class="highlight shell"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker pull nacos/nacos-server</span><br></pre></td></tr></tbody></table></figure></div>
</li>
<li><p>Sentinel</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">shell</div></div><figure class="highlight shell"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker pull bladex/sentinel-dashboard</span><br></pre></td></tr></tbody></table></figure></div>
</li>
<li><p>MySQL</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">shell</div></div><figure class="highlight shell"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker pull mysql</span><br></pre></td></tr></tbody></table></figure></div>
</li>
<li><p>Nginx</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">shell</div></div><figure class="highlight shell"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker pull nginx</span><br></pre></td></tr></tbody></table></figure></div>
</li>
</ul>
</blockquote>
<h1 id="5、开始搭建"><a href="#5、开始搭建" class="headerlink" title="5、开始搭建"></a>5、开始搭建</h1><h2 id="5-1-启动-Docker"><a href="#5-1-启动-Docker" class="headerlink" title="5.1 启动 Docker"></a>5.1 启动 Docker</h2><blockquote>
<p>略，不同系统启动命令不同</p>
</blockquote>
<h2 id="5-2-自定义网段"><a href="#5-2-自定义网段" class="headerlink" title="5.2 自定义网段"></a>5.2 自定义网段</h2><div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">shell</div></div><figure class="highlight shell"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">docker network create --subnet=192.168.32.0/24 cying #ip可自己指定, cying是网段名, 可自己指定</span><br><span class="line">docker network ls #查看当前已有网段</span><br></pre></td></tr></tbody></table></figure></div>

<p><a target="_blank" rel="noopener" href="https://img-blog.csdnimg.cn/20200806152347912.png" data-fancybox="group" data-caption="在这里插入图片描述" class="fancybox"><img alt="在这里插入图片描述" title="在这里插入图片描述" data-src="https://img-blog.csdnimg.cn/20200806152347912.png" class="lazyload"></a></p>
<h2 id="5-2-Nacos"><a href="#5-2-Nacos" class="headerlink" title="5.2 Nacos"></a>5.2 Nacos</h2><div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">Code</div></div><figure class="highlight plain"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">docker run -d\</span><br><span class="line"> -p 8848:8848\</span><br><span class="line"> -e TZ="Asia/Shanghai"\</span><br><span class="line"> --env MODE=standalone\</span><br><span class="line"> --restart=always\</span><br><span class="line"> --name Nacos\</span><br><span class="line"> --net cying\</span><br><span class="line"> --ip 192.168.32.10\</span><br><span class="line"> nacos/nacos-server</span><br><span class="line">-------------------------</span><br><span class="line">请修改参数：--name、--net、--ip</span><br><span class="line">其中：</span><br><span class="line">	--net 和 --ip 根据自定义网段来设置</span><br></pre></td></tr></tbody></table></figure></div>

<h2 id="5-3-Sentinel"><a href="#5-3-Sentinel" class="headerlink" title="5.3 Sentinel"></a>5.3 Sentinel</h2><div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">Code</div></div><figure class="highlight plain"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">docker run -d\</span><br><span class="line"> -p 8858:8858\</span><br><span class="line"> -e TZ="Asia/Shanghai"\</span><br><span class="line"> --restart=always\</span><br><span class="line"> --name Sentinel\</span><br><span class="line"> --net cying\</span><br><span class="line"> --ip 192.168.32.11\</span><br><span class="line"> bladex/sentinel-dashboard</span><br><span class="line">-------------------------</span><br><span class="line">请修改参数：--name、--net、--ip</span><br><span class="line">其中：</span><br><span class="line">	--net 和 --ip 根据自定义网段来设置</span><br></pre></td></tr></tbody></table></figure></div>

<h2 id="5-4-MySQL"><a href="#5-4-MySQL" class="headerlink" title="5.4 MySQL"></a>5.4 MySQL</h2><p><strong>前期准备</strong></p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">shell</div></div><figure class="highlight shell"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">mkdir /docker/v/mysql/data</span><br><span class="line">vim /docker/v/mysql/my.conf</span><br><span class="line"><span class="meta">#</span><span class="bash"> /docker/v/mysql 是我个人习惯, 读者可自行修改</span></span><br></pre></td></tr></tbody></table></figure></div>

<p><code>my.conf</code> 内容：</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">Code</div></div><figure class="highlight plain"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">[mysqld]</span><br><span class="line">user=mysql</span><br><span class="line">character-set-server=utf8</span><br><span class="line">default_authentication_plugin=mysql_native_password</span><br><span class="line"></span><br><span class="line">[client]</span><br><span class="line">default-character-set=utf8</span><br><span class="line"></span><br><span class="line">[mysql]</span><br><span class="line">default-character-set=utf8</span><br></pre></td></tr></tbody></table></figure></div>

<p><strong>创建容器</strong></p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">Code</div></div><figure class="highlight plain"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">docker run -d\</span><br><span class="line"> -p 3306:3306\</span><br><span class="line"> -e TZ="Asia/Shanghai"\</span><br><span class="line"> -e MYSQL_ROOT_PASSWORD=root\</span><br><span class="line"> --restart=always\</span><br><span class="line"> --name MySQL\</span><br><span class="line"> --net cying\</span><br><span class="line"> --ip 192.168.32.9\</span><br><span class="line"> -v /docker/v/mysql/config/my.conf:/etc/my.conf\</span><br><span class="line"> -v /docker/v/mysql/data:/var/lib/mysql\</span><br><span class="line"> mysql</span><br><span class="line">-------------------------</span><br><span class="line">请修改参数：--name、--net、--ip、-v</span><br><span class="line">其中：</span><br><span class="line">	--net 和 --ip 根据自定义网段来设置</span><br><span class="line">	-v 请将 /docker/v/mysql 修改为自己的路径</span><br></pre></td></tr></tbody></table></figure></div>

<h2 id="5-5-Nginx"><a href="#5-5-Nginx" class="headerlink" title="5.5 Nginx"></a>5.5 Nginx</h2><p><strong>前期准备</strong></p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">Code</div></div><figure class="highlight plain"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">mkdir /docker/v/nginx</span><br><span class="line">vim /docker/v/nginx/nginx.conf</span><br></pre></td></tr></tbody></table></figure></div>

<p><code>nginx.conf</code> 内容：</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">Code</div></div><figure class="highlight plain"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line">user  nginx;</span><br><span class="line">worker_processes  1;</span><br><span class="line">error_log   /var/log/nginx/error.log warn;</span><br><span class="line">pid         /var/run/nginx.pid;</span><br><span class="line"></span><br><span class="line">events {</span><br><span class="line">    worker_connections  1024;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line">http {</span><br><span class="line">    include         /etc/nginx/mime.types;</span><br><span class="line">    default_type    application/octet-stream;</span><br><span class="line">    log_format  main    '$remote_addr - $remote_user [$time_local] "$request" '</span><br><span class="line">                        '$status $body_bytes_sent "$http_referer" '</span><br><span class="line">                        '"$http_user_agent" "$http_x_forwarded_for"';</span><br><span class="line">    access_log  /var/log/nginx/access.log  main;</span><br><span class="line">    sendfile        on;</span><br><span class="line">    #tcp_nopush     on;</span><br><span class="line">    keepalive_timeout   65;</span><br><span class="line">    #gzip   on;</span><br><span class="line">    #server {</span><br><span class="line">    #}</span><br><span class="line">    include /etc/nginx/conf.d/*.conf;</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></tbody></table></figure></div>

<p><strong>创建容器</strong></p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">Code</div></div><figure class="highlight plain"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">docker run -d\</span><br><span class="line"> -p 80:80\</span><br><span class="line"> -e TZ="Asia/Shanghai"\</span><br><span class="line"> --restart=always\</span><br><span class="line"> --name Nginx\</span><br><span class="line"> --net cying\</span><br><span class="line"> --ip 192.168.32.12\</span><br><span class="line"> -v /docker/v/nginx/nginx.conf:/etc/nginx/nginx.conf\</span><br><span class="line"> nginx</span><br><span class="line">-------------------------</span><br><span class="line">请修改参数：--name、--net、--ip、-v</span><br><span class="line">其中：</span><br><span class="line">	--net 和 --ip 根据自定义网段来设置</span><br><span class="line">	-v 请将 /docker/v/nginx 修改为自己的路径</span><br></pre></td></tr></tbody></table></figure></div>

<h1 id="6、使用"><a href="#6、使用" class="headerlink" title="6、使用"></a>6、使用</h1><blockquote>
<p>到此为止，环境就配置完成了，如何使用呢？</p>
<ul>
<li><p>这里以 <code>SpringCloud</code> 微服务为例，每个微服务都有自己的端口，设有如下微服务</p>
<ul>
<li><code>Student</code> 服务：<code>port=2001</code>，<code>RequestMapping=/stu</code></li>
<li><code>Department</code> 服务：<code>port=2002</code>，<code>RequestMapping=/dept</code></li>
</ul>
</li>
<li><p>微服务中的 <code>Nacos</code>、<code>Sentinel</code>、<code>MySQL</code> 服务器地址就可以直接使用对应 <code>docker</code> 容器的地址了</p>
</li>
<li><p>再在 <code>nginx.conf</code> 的 <code>server</code> 块添加配置，令 <code>/stu</code> 转发到 <code>2001</code> 端口，<code>/dept</code> 转发到 <code>2002</code> 端口即可</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">Code</div></div><figure class="highlight plain"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">server {</span><br><span class="line">	···</span><br><span class="line">	location ~ /stu {</span><br><span class="line">		proxy_pass http://ip_addr:2001</span><br><span class="line">	}</span><br><span class="line">	···</span><br><span class="line">}</span><br></pre></td></tr></tbody></table></figure></div>
</li>
</ul>
</blockquote>
<h1 id="7、附-Tomcat-配置"><a href="#7、附-Tomcat-配置" class="headerlink" title="7、附 Tomcat 配置"></a>7、附 Tomcat 配置</h1><ul>
<li><p>拉取 <code>Tomcat</code></p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">shell</div></div><figure class="highlight shell"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker pull tomcat</span><br></pre></td></tr></tbody></table></figure></div>
</li>
<li><p>启动 <code>tomcat</code></p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">shell</div></div><figure class="highlight shell"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -d --name Tomcat -p 8080:8080 tomcat</span><br></pre></td></tr></tbody></table></figure></div>
</li>
<li><p>mkdir /docker/v/tomcat</p>
</li>
<li><p>复制配置文件、<code>webapps</code></p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">Code</div></div><figure class="highlight plain"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">docker cp tomcat:/usr/local/tomcat/conf/tomcat-user.xml /docker/v/tomcat/tomcat-user.xml</span><br><span class="line">docker cp tomcat:/usr/local/tomcat/webapps.dist /docker/v/tomcat/webapps</span><br></pre></td></tr></tbody></table></figure></div>
</li>
<li><p>编辑 <code>tomcat-user.xml</code>，先检查文件权限并根据情况做出调整</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">xml</div></div><figure class="highlight xml"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">< ?<span class="attr">xml</span> <span class="attr">version</span>=<span class="string">"1.0"</span> <span class="attr">encoding</span>=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"><span class="tag"><<span class="name">tomcat-users</span> <span class="attr">xmlns</span>=<span class="string">"http://tomcat.apache.org/xml"</span></span></span><br><span class="line"><span class="tag">              <span class="attr">xmlns:xsi</span>=<span class="string">"http://www.w3.org/2001/XMLSchema-instance"</span></span></span><br><span class="line"><span class="tag">              <span class="attr">xsi:schemaLocation</span>=<span class="string">"http://tomcat.apache.org/xml tomcat-users.xsd"</span></span></span><br><span class="line"><span class="tag">              <span class="attr">version</span>=<span class="string">"1.0"</span>></span></span><br><span class="line">    <span class="tag"><<span class="name">role</span> <span class="attr">rolename</span>=<span class="string">"manager-gui"</span> /></span></span><br><span class="line">    <span class="tag"><<span class="name">role</span> <span class="attr">rolename</span>=<span class="string">"manager-script"</span> /></span></span><br><span class="line">    <span class="tag"><<span class="name">role</span> <span class="attr">rolename</span>=<span class="string">"manager-status"</span> /></span></span><br><span class="line">    <span class="tag"><<span class="name">role</span> <span class="attr">rolename</span>=<span class="string">"manager-jmx"</span> /></span></span><br><span class="line">    <span class="tag"><<span class="name">user</span> <span class="attr">username</span>=<span class="string">"tomcat"</span> <span class="attr">password</span>=<span class="string">"root"</span> <span class="attr">roles</span>=<span class="string">"manager-gui,manager-script,manager-status,manager-jmx /></span></span></span><br><span class="line"><span class="tag"><span class="string"></span></span></span><br></pre></td></tr></tbody></table></figure></div>
</li>
<li><p>编辑 <code>webapps/manager/META-INF/context.xml</code>，先检查文件权限并根据情况做出调整</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">xml</div></div><figure class="highlight xml"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">< ?<span class="attr">xml</span> <span class="attr">version</span>=<span class="string">"1.0"</span> <span class="attr">encoding</span>=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"><span class="tag"><<span class="name">Context</span> <span class="attr">antiResourceLocking</span>=<span class="string">"false"</span> <span class="attr">privileged</span>=<span class="string">"true"</span> ></span></span><br><span class="line">  <span class="tag"><<span class="name">Manager</span> <span class="attr">sessionAttributeValueClassNameFilter</span>=<span class="string">"java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"</span>/></span></span><br><span class="line"><span class="tag">< /<span class="attr">Context</span>></span></span><br></pre></td></tr></tbody></table></figure></div>
</li>
<li><p>干掉第一个容器</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">shell</div></div><figure class="highlight shell"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">docker stop Tomcat</span><br><span class="line">docker rm Tomcat</span><br></pre></td></tr></tbody></table></figure></div>
</li>
<li><p>创建新的容器</p>
<div class="code-area-wrap"><div class="highlight-tools"><i class="fa fa-angle-down code-expand" aria-hidden="true"></i><div class="code_lang">Code</div></div><figure class="highlight plain"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">docker run -d\</span><br><span class="line"> -p 8080:8080\</span><br><span class="line"> -e TZ="Asia/Shanghai"\</span><br><span class="line"> --restart=always\</span><br><span class="line"> --name Tomcat\</span><br><span class="line"> --net cying\</span><br><span class="line"> --ip 192.168.32.8\</span><br><span class="line"> -v /etc/localtime:/etc/localtime:ro\</span><br><span class="line"> -v /docker/v/tomcat/tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml\</span><br><span class="line"> -v /docker/v/tomcat/webapps:/usr/local/tomcat/webapps\</span><br><span class="line"> tomcat</span><br><span class="line">-------------------------</span><br><span class="line">请修改参数：--name、--net、--ip、-v</span><br><span class="line">其中：</span><br><span class="line">	--net 和 --ip 根据自定义网段来设置</span><br><span class="line">	-v 请将 /docker/v/tomcat 修改为自己的路径</span><br></pre></td></tr></tbody></table></figure></div></li>
</ul>
</body></html></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a href="mailto:undefined">Cying-承影</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="http://cyingk.github.io/2020/08/06/Linux-And-Docker/">http://cyingk.github.io/2020/08/06/Linux-And-Docker/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/JavaEE/">JavaEE</a></div><div class="post_share"></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2020/08/07/Hexo-To-Own-Server/"><img class="prev-cover" src="https://gitee.com/CyingK/files/raw/master/images/Cying/hexo.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">Previous Post</div><div class="prev_info">Push Hexo to your own server</div></div></a></div><div class="next-post pull-right"><a href="/2020/07/22/JVM-Theory/"><img class="next-cover" src="https://gitee.com/CyingK/files/raw/master/images/JVM/JVM-logo.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">Next Post</div><div class="next_info">JVM-Theory</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> Related Articles</span></div><div class="relatedPosts-list"><div><a href="/2020/05/05/SpringCloud/" title="SpringCloud"><img class="cover" src="http://img3.imgtn.bdimg.com/it/u=1799420697,1254911040&fm=26&gp=0.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-05-05</div><div class="title">SpringCloud</div></div></a></div><div><a href="/2020/04/05/SpringBoot/" title="SpringBoot"><img class="cover" src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=4157804759,1050439081&fm=26&gp=0.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-04-05</div><div class="title">SpringBoot</div></div></a></div><div><a href="/2020/02/20/Mybatis/" title="MyBatis"><img class="cover" src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=575314515,4268715674&fm=26&gp=0.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-02-20</div><div class="title">MyBatis</div></div></a></div><div><a href="/2020/02/16/SpringMVC/" title="SpringMVC"><img class="cover" src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=790255512,3591398303&fm=26&gp=0.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-02-16</div><div class="title">SpringMVC</div></div></a></div><div><a href="/2020/02/15/Hibernate/" title="Hibernate"><img class="cover" src="https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=607365457,3589909035&fm=26&gp=0.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-02-15</div><div class="title">Hibernate</div></div></a></div><div><a href="/2020/02/01/Struts2/" title="Struts2"><img class="cover" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2597327423,2034793762&fm=26&gp=0.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-02-01</div><div class="title">Struts2</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>Catalog</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#1%E3%80%81%E5%AE%89%E8%A3%85-Linux-%E7%B3%BB%E7%BB%9F"><span class="toc-number">1.</span> <span class="toc-text">1、安装 Linux 系统</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#2%E3%80%81%E5%AE%89%E8%A3%85-docker"><span class="toc-number">2.</span> <span class="toc-text">2、安装 docker</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#3%E3%80%81%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5"><span class="toc-number">3.</span> <span class="toc-text">3、远程连接</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#4%E3%80%81%E6%8B%89%E9%95%9C%E5%83%8F"><span class="toc-number">4.</span> <span class="toc-text">4、拉镜像</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#5%E3%80%81%E5%BC%80%E5%A7%8B%E6%90%AD%E5%BB%BA"><span class="toc-number">5.</span> <span class="toc-text">5、开始搭建</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#5-1-%E5%90%AF%E5%8A%A8-Docker"><span class="toc-number">5.1.</span> <span class="toc-text">5.1 启动 Docker</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-2-%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BD%91%E6%AE%B5"><span class="toc-number">5.2.</span> <span class="toc-text">5.2 自定义网段</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-2-Nacos"><span class="toc-number">5.3.</span> <span class="toc-text">5.2 Nacos</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-3-Sentinel"><span class="toc-number">5.4.</span> <span class="toc-text">5.3 Sentinel</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-4-MySQL"><span class="toc-number">5.5.</span> <span class="toc-text">5.4 MySQL</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-5-Nginx"><span class="toc-number">5.6.</span> <span class="toc-text">5.5 Nginx</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#6%E3%80%81%E4%BD%BF%E7%94%A8"><span class="toc-number">6.</span> <span class="toc-text">6、使用</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#7%E3%80%81%E9%99%84-Tomcat-%E9%85%8D%E7%BD%AE"><span class="toc-number">7.</span> <span class="toc-text">7、附 Tomcat 配置</span></a></li></ol></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="footer_custom_text">却道天凉好个秋</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="Read Mode"><i class="fas fa-book-open"></i></button><button id="font-plus" type="button" title="Increase font size"><i class="fas fa-plus"></i></button><button id="font-minus" type="button" title="Decrease font size"><i class="fas fa-minus"></i></button><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="Table Of Contents"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="Back To Top"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (false){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>if (document.getElementsByClassName('mermaid').length) {
  if (window.mermaidJsLoad) mermaid.init()
  else {
    getScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js').then(() => {
      window.mermaidJsLoad = true
      mermaid.initialize({
        theme: 'default',
      })
      false && mermaid.init()
    })
  }
}</script></div><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>